﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace SyncUdp.Event
{
    using SyncUdp.Event.NetworkEvent;
    using SyncUdp.Interface;
    using System.Collections.Concurrent;

    namespace GameEvent
    {        
        /// <summary>
        /// 游戏退出的事件
        /// </summary>
        public struct GameQuitEvent : IEventArgs { }

        /// <summary>
        /// 游戏成功创建的事件
        /// </summary>
        public struct GameCreatedSuccessfullyEvent : IEventArgs { }

        public struct PlayerModelReceiveInputsEvent : IEventArgs 
        {
            public Model.PlayerInputs inputs;
        }

        public struct ClientHasReceivedInputsEvent : IEventArgs 
        {
            public bool isToReissue;
            public ConcurrentQueue<List<ClientInputsEvent>> inputsCache;
        }

        public struct GameHasDisconnectedEvent : IEventArgs 
        {
            public bool isTryingReconnection;
        }

        public struct GameReconnectedSuccessfullyEvent : IEventArgs { }

        public struct GameJoinedSuccessfullyEvent : IEventArgs 
        {
            public System.Net.Sockets.UdpClient udpClient;
            public int playerId;
            public string playerName;
            public List<int> otherIds;
            public List<string> otherNames;
        }

        public struct OtherPlayerDisconnectedEvent : IEventArgs
        {
            public string otherPlayerName;
        }

        public struct OtherPlayerJoinedGameEvent : IEventArgs
        {
            public string otherPlayerName;
        }
    }
}
